bitkeeper revision 1.1159.258.137 (428b746dvt7HoFn2rjyGGO-i1yesPg)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 18 May 2005 16:59:25 +0000 (16:59 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 18 May 2005 16:59:25 +0000 (16:59 +0000)
Ensure that domain0 console receiver does not get stuck if serial
input is received early during boot. Fixes bugzilla bug #41.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/drivers/char/console.c

index ba4c53f927ab3135b93eb762c49b604958670a55..f4864f57440b0f87cedc0ef12cbd329afd633a3a 100644 (file)
@@ -260,15 +260,13 @@ static void switch_serial_input(void)
 static void __serial_rx(unsigned char c, struct xen_regs *regs)
 {
     if ( xen_rx )
-    {
-        handle_keypress(c, regs);
-    }
-    else if ( (serial_rx_prod-serial_rx_cons) != SERIAL_RX_SIZE )
-    {
-        serial_rx_ring[SERIAL_RX_MASK(serial_rx_prod)] = c;
-        if ( serial_rx_prod++ == serial_rx_cons )
-            send_guest_virq(dom0, VIRQ_CONSOLE);
-    }
+        return handle_keypress(c, regs);
+
+    /* Deliver input to guest buffer, unless it is already full. */
+    if ( (serial_rx_prod-serial_rx_cons) != SERIAL_RX_SIZE )
+        serial_rx_ring[SERIAL_RX_MASK(serial_rx_prod++)] = c;
+    /* Always notify the guest: prevents receive path from getting stuck. */
+    send_guest_virq(dom0, VIRQ_CONSOLE);
 }
 
 static void serial_rx(unsigned char c, struct xen_regs *regs)